////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//  Filename:    ParadiseDreamsGuts.h                                         //
//  Developer:   Tommy Riddle                                                 //
//  Create date: 05/18/2006                                                   //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//  Description: This is the class declaration for the slot gut of the        //
//               Australian Slot machine called Paradise Dreams.              //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
//        Copyright (c) 2006 - Realtime Gaming.  All rights reserved.         //
////////////////////////////////////////////////////////////////////////////////

#if !defined(__PARADISEDREAMSGUTS_H__)
#define __PARADISEDREAMSGUTS_H__

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


#include "slotguts.h"


class ParadiseDreamsGuts : public SlotGuts
{
public:
	ParadiseDreamsGuts();

	virtual ~ParadiseDreamsGuts();

private:
	// Shared enums between client and server
	#include "ParadiseDreamsCommon.h"

	// Probability Tables
    enum ProbabilityTables
    {
		PROB_TABLE_WHICH_FEATURE = 0,
		PROB_TABLE_AWARD_EXTRA_PICKS = 1,
		PROB_TABLE_PICK_PRIZE = 2,
		PROB_TABLE_BUTTERFLY_BONUS_PRIZE = 3,
	};

	// Feature
	enum Feature
	{
		FEATURE_FREE_GAMES= 0,
		FEATURE_PARADISE_PICK = 1
	};

	// Paradise Pick Constants
	enum ParadisePickConstants
	{
		PARADISE_PICK_PRIZE_INVALID = -1,
		NUM_PARADISE_PICK_CHOICES = 12
	};

	// Helpful lookup arrays.
	static SpinResult m_aLineWinSpinResults[][6];

	static SpinResult m_aScatterWinSpinResults[6];

	// Inline functions to use with the arrays that also do
	// bounds checking.
	static SpinResult lookupLineWinSpinResult( uint8 nIconType, uint8 nCount )
	{
		if ( nIconType < NUM_VALID_ICONS && nCount < 6 )
		{
			return m_aLineWinSpinResults[ nIconType ][ nCount ];
		}

		ASSERT( false );
		return EVT_INVALID;
	}

	static SpinResult lookupScatterWinSpinResult( uint8 nCount )
	{
		if ( nCount < 6 )
		{
			return m_aScatterWinSpinResults[ nCount ];
		}

		ASSERT( false );
		return EVT_INVALID;
	}

	// Helper functions for classifyStops.
	SpinResult getGirlLineWinResult( uint8* stops ) const;

	SpinResult getLineWinResultWithPossibleSubstitution(
		uint8* stops, uint8 testIcon, bool& bSubstitution ) const;

	bool doesGirlLineWinPayMore( SpinResult srGirl, SpinResult srOther,
		bool bSubstitution ) const;

	// Helper functions for classifyScatters.
	void tryForJackpot( SlotSpin* spin );

	SpinResult getScatterWinResult( SlotSpin* spin, int32& nNumScatterIcons, int32& nScatterPositions ) const;
	
	void evaluateScatterWin( SlotSpin* spin, SpinResult srScatterResult, int32 nScatterPositions );

	void addButterflyBonusScatters( SlotSpin* spin );

	void evaluateFeatureTrigger( SlotSpin* spin, int32 nNumScatterIcons, int32 nScatterPositions );

	int32 getCurrentPicksRemaining();
	void  setCurrentPicksRemaining( int32 nCurrentPicksRemaining );

	void addExtraPicks( int32 nExtraPicks );
	void decrementCurrentPicksRemaining();

	bool getAwardExtraPicks();
	void setAwardExtraPicks( bool bAwardExtraPicks );

	int32 getPrize( int32 nPickIndex );
	void setPrize( int32 nPickIndex, int32 nPrize );

	int32 getTotalPrize();

	BonusGame* addBonusGameThirdParty(uint8 bonusgametype,uint8 bonusgameindex,int32 basepayoutamount,int32 totalmultiplier,int32 totalbonuspayoutamount,int32 freespins);
	int32 getProgressiveValue();

public:
	virtual void classifyStops( SpinLine* spinline, uint8* stops, uint8 bet, uint8 line,
		uint8& rtnresult, uint8& multiplier );

	virtual void classifyScatters( SlotSpin *spin );

    virtual bool8 isValidGuts();

    virtual void getGameModeMultiplierAndNoteId( uint8& nGameModeMultiplier, uint8& nNoteId );

	virtual bool8 processClientData( uint8 bonusGameType, int32 bonusDataCount, int32 *bonusData );

protected:
	// Override these framework functions.
	virtual bool8 hasSavedGames();

	virtual void Debug_SetLoserStops( uint8* pStops );

	virtual void initDebugFunctionMap();

	enum
	{
		EVT_DEBUG_FUNCTION_SPINS = BEGIN_SUB_MODIFY_NEXT_RESULT_FUNCTION_RANGE,
		EVT_DEBUG_FUNCTION_FEATURE,

		EVT_DEBUG_FUNCTION_BUTTERFLY_YES,
		EVT_DEBUG_FUNCTION_BUTTERFLY_NO,

		EVT_DEBUG_FUNCTION_1X_PRIZE,
		EVT_DEBUG_FUNCTION_2X_PRIZE,
		EVT_DEBUG_FUNCTION_3X_PRIZE,
		EVT_DEBUG_FUNCTION_5X_PRIZE,
		EVT_DEBUG_FUNCTION_10X_PRIZE,
		EVT_DEBUG_FUNCTION_20X_PRIZE,
		EVT_DEBUG_FUNCTION_50X_PRIZE,
		EVT_DEBUG_FUNCTION_100X_PRIZE,
		EVT_DEBUG_FUNCTION_250X_PRIZE,
		EVT_DEBUG_FUNCTION_1000X_PRIZE,
	};

	void DebugFeature_FreeSpins(SlotSpin *spin );
	void DebugFeature_Feature(SlotSpin *spin );

	void DebugFeature_ButterFlyYes(SlotSpin *spin );
	void DebugFeature_ButterFlyNo(SlotSpin *spin );

	void DebugFeature_Prize_1X( SlotSpin *spin );
	void DebugFeature_Prize_2X( SlotSpin *spin );
	void DebugFeature_Prize_3X( SlotSpin *spin );
	void DebugFeature_Prize_5X( SlotSpin *spin );
	void DebugFeature_Prize_10X( SlotSpin *spin );
	void DebugFeature_Prize_20X(SlotSpin *spin );
	void DebugFeature_Prize_50X( SlotSpin *spin );
	void DebugFeature_Prize_100X( SlotSpin *spin );
	void DebugFeature_Prize_250X( SlotSpin *spin );
	void DebugFeature_Prize_1000X(SlotSpin *spin );

	static int g_nDebugForceTrigger;
	static int g_nDebugButterFly;
	static int g_nDebugPrizeIndex;
	static int g_nDebugPrize[10];	//ten picks would be maximum
};


#endif // !defined(__PARADISEDREAMSGUTS_H__)
